package com.taomu.app.zongchouhuli.moudle.home.activity;

import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.taomu.app.zongchouhuli.R;
import com.taomu.app.zongchouhuli.entity.BaseFinishEntity;
import com.taomu.app.zongchouhuli.entity.OnlyFinishOrder;
import com.taomu.app.zongchouhuli.framework.BaseActivity;
import com.taomu.app.zongchouhuli.framework.BasePresenter;
import com.taomu.app.zongchouhuli.moudle.mine.activity.UserOrderActivity;
import com.taomu.app.zongchouhuli.moudle.mine.activity.UserPatSuccessActivity;
import com.taomu.app.zongchouhuli.utils.RxBus2;

public class HomePaySuccessActivity extends BaseActivity {

    private ImageView mBackIm;

    private TextView mBackHomeTv;

    @Override
    protected int getContentLayout() {
        return R.layout.activity_home_pay_success;
    }

    @Override
    protected void initView() {
        mBackIm = findViewById(R.id.home_paysuccess_back_im);
        mBackHomeTv = findViewById(R.id.back_home);
    }

    @Override
    protected void initData() {
        RxBus2.getInstance().post(new OnlyFinishOrder());
    }

    @Override
    protected void initEvent() {
        mBackIm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UserOrderActivity.start(HomePaySuccessActivity.this, 0);
                finish();
            }
        });
        mBackHomeTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                RxBus2.getInstance().post(new BaseFinishEntity());
                finish();
            }
        });
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode == KeyEvent.KEYCODE_BACK){
            UserOrderActivity.start(HomePaySuccessActivity.this, 0);
            finish();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
